<%@page import="com.namabank.servlet.EvaluateParam"%>
<%@page import="java.util.HashMap"%>
<%@page contentType="text/html; charset=UTF-8"
        import="com.namabank.util.TemplateFile"
%><%
            String contextpath = request.getContextPath();
            String userName = "";//"hiennt/custinfo";///qltiengia <%@ include file="includejs.jsp"% >
            String userPassword = "";
%><%@include  file="WEB-INF/jspf/commons/common-func.jspf"%><%
            if (request.getParameter("logout") != null && request.getSession() != null) {
                request.getSession().invalidate();
            }
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
        <title>Đăng nhập</title>

        <link rel="shortcut icon" href="<%=getFullPath(request, "images/favicons.ico")%>" type="image/x-icon" />
        <link type="text/css" href="<%=getFullPath(request, getFileLastModifiedAfterPath("templates/default/jquery-ui-1.8.6.css"))%>" rel="stylesheet"/>
        <link type="text/css" href="<%=getFullPath(request, getFileLastModifiedAfterPath("templates/default/template_css.css"))%>" rel="stylesheet"/>

        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery-1.5.2.min.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("templates/default/js/jquery-ui-1.8.6.min.js"))%>"></script>

        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery-othlib.min.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery.jPrintArea.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery.layout1.3.29.14.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/jquery.treeview.js"))%>"></script>
        <script type="text/javascript" src="<%=getFullPath(request, getFileLastModifiedAfterPath("js/hien.common.js"))%>"></script>

        <style type="text/css">
            #cpBackgroundImg {
                left:0px;
                position:absolute;
                top:0;
                z-index:0;
            }
            .text-on-deskboard{
                color:white;
            }
        </style>
        <script type="text/javascript">
        </script>
    </head>
    <body onload="$('#username').focus();">
        <%
                    TemplateFile tr = new TemplateFile();
                    String contentPanel = tr.readTemplateHTML("templates/logon_screen/default.html");
                    HashMap<String, Object> params = new HashMap<String, Object>();
                    params.put("userName", "hienntr");
                    params.put("userPassword", "123456");
                    contentPanel = tr.replaceByParams(contentPanel, params);
                    out.println(contentPanel);
        %>
        <div style="display:none;">
            <form id="form-login" action="<%=contextpath%>/base" method="POST">
                <input type="hidden" name="userid"/>
                <input type="hidden" name="hdPassword"/>
                <input type="hidden" name="state" value="login"/>
                <input type="hidden" name="sessionid" value="<%=java.util.UUID.randomUUID().toString().toLowerCase()%>"/>
            </form>

        </div>
        <div id="response-param" style="display:none;">
            <%
                        EvaluateParam evalParam = (EvaluateParam) request.getAttribute("evalparam");
                        if (evalParam != null) {
                            String responseHtml = evalParam.getResponseString();
                            out.print(responseHtml);
                        }
            %>
        </div>
        <div id="trash-area-for-remove"/>
        <div style="height: 40px;"></div>
    </body>
    <script type="text/javascript">
        document.isOlderMsie = false;
        if($.browser.msie && ($.browser.version < 8)){
            document.isOlderMsie = true;
            if($.browser.version < 7)
                $("#contentPanel").css("height", "400px");
        }
        $("input").keydown(function(event){
            if(event.keyCode == 13){
                login();
            }
        });
        $("button").button();
        $(document).keydown(function(event){
            if($.browser.msie && event.keyCode == 116){
                //logout();
            }
        });

        function login(){
            var username = $("#username").val();
            var pwd = $("#hdPassword").val();
            if(!username || !pwd){
                showMessageBox("Bạn phải nhập đầy đủ thông tin Username và Password!");
                return;
            }
            username = username.toUpperCase();
            //pwd = rstr2hex(rstr_md5(str2rstr_utf8(pwd)));
            var formLogin = $("#form-login")[0];
            formLogin.elements["userid"].value = username;
            formLogin.elements["hdPassword"].value = pwd;
            formLogin.submit();
        }
        defaultPostSuccess($("#response-param>div:first-child"));
    </script>

</html>
